package com.ticket.web.controller.yanchu;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ticket.common.annotation.Log;
import com.ticket.common.core.controller.BaseController;
import com.ticket.common.core.domain.AjaxResult;
import com.ticket.common.enums.BusinessType;
import com.ticket.system.domain.YuanchuRefundBackendOrderDetail;
import com.ticket.system.service.IYuanchuRefundBackendOrderDetailService;
import com.ticket.common.utils.poi.ExcelUtil;
import com.ticket.common.core.page.TableDataInfo;

/**
 * 出票退款明细Controller
 * 
 * @author ruoyi
 * @date 2024-02-19
 */
@RestController
@RequestMapping("/system/backendDetail")
public class YuanchuRefundBackendOrderDetailController extends BaseController
{
    @Autowired
    private IYuanchuRefundBackendOrderDetailService yuanchuRefundBackendOrderDetailService;

    /**
     * 查询出票退款明细列表
     */
    @PreAuthorize("@ss.hasPermi('system:detail:list')")
    @GetMapping("/list")
    public TableDataInfo list(YuanchuRefundBackendOrderDetail yuanchuRefundBackendOrderDetail)
    {
        startPage();
        List<YuanchuRefundBackendOrderDetail> list = yuanchuRefundBackendOrderDetailService.selectYuanchuRefundBackendOrderDetailList(yuanchuRefundBackendOrderDetail);
        return getDataTable(list);
    }

    /**
     * 导出出票退款明细列表
     */
    @PreAuthorize("@ss.hasPermi('system:detail:export')")
    @Log(title = "出票退款明细", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YuanchuRefundBackendOrderDetail yuanchuRefundBackendOrderDetail)
    {
        List<YuanchuRefundBackendOrderDetail> list = yuanchuRefundBackendOrderDetailService.selectYuanchuRefundBackendOrderDetailList(yuanchuRefundBackendOrderDetail);
        ExcelUtil<YuanchuRefundBackendOrderDetail> util = new ExcelUtil<YuanchuRefundBackendOrderDetail>(YuanchuRefundBackendOrderDetail.class);
        util.exportExcel(response, list, "出票退款明细数据");
    }

    /**
     * 获取出票退款明细详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:detail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(yuanchuRefundBackendOrderDetailService.selectYuanchuRefundBackendOrderDetailById(id));
    }

    /**
     * 新增出票退款明细
     */
    @PreAuthorize("@ss.hasPermi('system:detail:add')")
    @Log(title = "出票退款明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YuanchuRefundBackendOrderDetail yuanchuRefundBackendOrderDetail)
    {
        return toAjax(yuanchuRefundBackendOrderDetailService.insertYuanchuRefundBackendOrderDetail(yuanchuRefundBackendOrderDetail));
    }

    /**
     * 修改出票退款明细
     */
    @PreAuthorize("@ss.hasPermi('system:detail:edit')")
    @Log(title = "出票退款明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YuanchuRefundBackendOrderDetail yuanchuRefundBackendOrderDetail)
    {
        return toAjax(yuanchuRefundBackendOrderDetailService.updateYuanchuRefundBackendOrderDetail(yuanchuRefundBackendOrderDetail));
    }

    /**
     * 删除出票退款明细
     */
    @PreAuthorize("@ss.hasPermi('system:detail:remove')")
    @Log(title = "出票退款明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(yuanchuRefundBackendOrderDetailService.deleteYuanchuRefundBackendOrderDetailByIds(ids));
    }
}
